<style type="text/css">
    .layui-table-body{overflow-x:auto;}
    .layui-table-cell{font-size:12px;}
</style>
<div class="layui-form hisi-search">
    <form action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
            <label class="layui-form-label">订单号：</label>
            <div class="layui-input-inline">
                <input type="text" name="keyword" class="layui-input" lay-verify="required" placeholder="请输入待查询的订单号" />
            </div>
        </div>
        <div class="layui-form-item hisi-search-btn">
            <div class="layui-input-inline">
                <button type="submit" class="layui-btn layui-btn-normal layui-icon layui-icon-search">查询</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-icon layui-icon-delete">重置</button>
            </div>
        </div>
    </form>
</div>

<table id="dataTable"></table>
<script type="text/html" id="usernameTpl">
    <div style="line-height:18px;">
        <img src="{{ d.has_certification ? d.has_certification.man_avatar : '__ADMIN_IMG__/avatar.png' }}" width="60" height="60" class="fl">
        <p class="ml10 fl"><strong class="mcolor">{{ d.has_certification ? d.has_certification.true_name : d.mobile }} </strong><br>手机：{{ d.mobile }}</p>
    </div>
</script>
<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}&hisiModel=order">
</script>
<script type="text/html" id="paystatusTpl">
    <input type="checkbox" name="pay_status" value="{{ d.pay_status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="已支付|未支付" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('paystatus')}?id={{ d.id }}&hisiModel=order">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}&tpl=live_form&hisiModel=live" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '550px', height: '420px', title: '修改节目'}">修改</a>
    <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    
</script>
<script type="text/javascript">
    layui.use(['jquery', 'laydate', 'table'], function() {
        var $ = layui.jquery, laydate = layui.laydate, table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[ //表头
                {field: 'id', title: 'id',width: 100}
                ,{field: 'order_sn', title: '订单号',width: 100}
                ,{field: 'goods_name', title: '商品',width: 200, templet: function(d){
                    return d.goods_info.goods_name;
                }}
                ,{field: 'user_name', title: '用户',width: 200, templet: function (d){
                    return d.user_info.username ? d.user_info.username : (d.user_info.nick ? d.user_info.nick : d.user_info.mobile)
                }}
                ,{field: 'money', title: '支付金额',width: 200}
                ,{field: 'pay_method', title: '支付方式',width: 200}
                ,{field: 'pay_status', title: '支付状态',width: 200, templet: '#paystatusTpl'}
                ,{field: 'status', title: '订单状态', width: 100, templet: '#statusTpl'}
                ,{field: 'create_time', title: '创建时间', width: 100}
                // ,{title: '操作', templet: '#buttonTpl'}
            ]]
            ,done: function(){
                if (typeof(layui.global.addTableTool) !== 'undefined') {
                    layui.global.addTableTool();
                }
            }
        });
    });
</script>